home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / linuxcon.000 / linuxcon / linuxconf-1.6 / dialog / inputbox.c < prev    next >
C/C++ Source or Header  |  1995-11-07  |  1KB  |  49 lines

  1. #include "dialog.h"
  2.     
  3. /*
  4.     Display a dialog box for inputing a string
  5.     Returne MENU_ACCEPT or MENU_CANCEL or MENU_ESCAPE.
  6. */
  7. MENU_STATUS dialog_inputbox(
  8.     const char *title,
  9.     const char *prompt,
  10.     const char *helpfile,
  11.     char inpstr[MAX_LEN+1])
  12. {
  13.     DIALOG dia;
  14.     inpstr[0] = '\0';
  15.     dia.newf_str ("",inpstr,MAX_LEN);
  16.     return dia.edit (title,prompt,helpfile,0);
  17. }
  18. /*
  19.     Display a dialog box for inputing a password (mangled echo)
  20.     Returne MENU_ACCEPT or MENU_CANCEL or MENU_ESCAPE.
  21.  */
  22. MENU_STATUS dialog_inputpass(
  23.     const char *title,
  24.     const char *prompt,
  25.     const char *helpfile,
  26.     char inpstr[MAX_LEN+1])
  27. {
  28.     DIALOG dia;
  29.     SSTRING tmp(inpstr);
  30.     dia.newf_pass ("",tmp);
  31.     MENU_STATUS ret = dia.edit (title,prompt,helpfile,0);
  32.     tmp.copy (inpstr);
  33.     return ret;
  34. }
  35.  
  36. #ifdef TEST
  37.  
  38. int main (int argc, char *argv[])
  39. {
  40.     init_dialog();
  41.     char input[MAX_LEN+1];
  42.     dialog_inputbox ("This is a test",NULL,NULL,input);
  43.     dialog_inputpass ("This is a test","Please\nenter\na Password",NULL,input);
  44.     endwin();
  45.     return 0;
  46. }
  47. #endif
  48.  
  49.